import React from 'react'
import {Spin} from 'antd'
import app from '../../app'

class MainLayout extends React.Component {

    render() {

        const {children} = this.props;

        return app.mobile ? (<div>{children}</div>) : (
            <div style={{
                position: "absolute",
                top: "50%",
                left: "50%",
                margin: "-60px 0 0 -100px",
                width: "100px",
                height: "100px",
                textAlign: "center"
            }}>
                <Spin size="large" tip={children}>
                    <div style={{width: "100px", height: "100px"}}></div>
                </Spin>
            </div>
        );
    }
}

export const createRoutes = (store) => ({
    path: '/__oauth2',
    component: MainLayout,
    childRoutes: [
        require('./auth').default(store),
        require('./callback').default(store),
        require('./logout').default(store)
    ],
});

export default createRoutes
